/**
 * Classe factory che consente la generazione di messaggi di un certo tipo
 *
 */
public class MessageFactory {
	public static Message GeneratePingRequest() {
		return new Message(OperationType.PING, "Ping request");
	}

	public static Message GeneratePingResponse() {
		return new Message(OperationType.PING, "Ping response");
	}

	public static Message GenerateCloseMessage() {
		return new Message(OperationType.CLOSESOCKET, "Close request");
	}

	public static Message GenerateTranslateRequest(String itaWord) {
		Message m = new Message(OperationType.TRANSLATE, "Translation request");
		m.setItaWord(itaWord);
		return m;
	}

	public static Message GenerateTranslateResponse(String itaWord,
			String engWord, boolean hasError) {
		Message m = new Message(OperationType.TRANSLATE, "Translation response");
		m.setItaWord(itaWord);
		m.setEngWord(engWord);
		m.setHasError(hasError);
		return m;
	}

	public static Message GenerateInsertRequest(String itaWord, String engWord) {
		Message m = new Message(OperationType.INSERT, "Insert request");
		m.setItaWord(itaWord);
		m.setEngWord(engWord);
		return m;
	}

	public static Message GenerateInsertResponse(String itaWord,
			String engWord, boolean hasError) {
		Message m = new Message(OperationType.INSERT, "Insert response");
		m.setItaWord(itaWord);
		m.setEngWord(engWord);
		m.setHasError(hasError);
		return m;
	}
}
